package com.txh.blog.service.Impl;

import com.github.pagehelper.PageHelper;
import com.txh.blog.bean.Type;
import com.txh.blog.dao.TypeDao;
import com.txh.blog.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl implements TypeService{
    @Autowired
    TypeDao typeDao;

    @Override
    public void save(Type type) {

        typeDao.save(type);
    }

    @Override
    public Type findById(Long id) {
        return typeDao.findById(id);
    }
//   查询所有
    @Override
    public List<Type> findAll(int page, int pageSize) {
        PageHelper.startPage(page, pageSize);
        return typeDao.findAll();
    }

    @Override
    public void update(Type type) {
       typeDao.update(type);
    }

    @Override
    public void delete(Long id) {
       typeDao.delete(id);
    }

    @Override
    public List<Type> listTypeSize() {
        return typeDao.listTypeSize();
    }

    @Override
    public List<Type> listType() {
        return typeDao.listType();
    }

    @Override
    public Type findByName(String name) {
        return typeDao.findByName(name);
    }
}
